package com.zyh.system.supermarket.controller;

import com.zyh.system.supermarket.dao.impl.UserDaoImpl;
import com.zyh.system.supermarket.domain.UserInfo;
import com.zyh.system.supermarket.service.impl.UserServiceImpl;

import java.util.Scanner;
import java.util.TreeMap;

/**
 * @Author zyh
 * @Date 2024/8/3 14:35
 * @Description 超市用户管理系统首页
 */

public class Index {
    public static final Scanner INPUT = new Scanner(System.in);
    public static final TreeMap<String, UserInfo> USER_SET = UserDaoImpl.USER_SET;
    public static final UserServiceImpl USER_SERVICE = new UserServiceImpl();

    public static void main(String[] args) {
        while (true) {
            System.out.println("===========================欢迎使用超市用户管理系统==========================================");
            System.out.println("1.查询会员信息");
            System.out.println("2.删除会员信息");
            System.out.println("3.新增会员信息");
            System.out.println("4.修改会员积分");
            System.out.println("5.退出系统");
            System.out.println("=========================================================================================");
            System.out.println("请输入您的选择：");
            int choice = INPUT.nextInt();
            switch (choice) {
                case 1://查询会员信息
                    USER_SERVICE.selectAll(USER_SET);
                    break;
                case 2://删除会员信息
                    USER_SERVICE.deleteUserInfoById(USER_SET);
                    break;
                case 3://新增会员信息
                    USER_SERVICE.addUserInfo(USER_SET);
                    break;
                case 4://修改会员积分
                    USER_SERVICE.updateScore(USER_SET);
                    break;
                default:
                    System.out.println("系统退出！");
                    System.exit(0);
            }
        }
    }
}
